package com.ruoyi.hospital.entity.check;

import com.ruoyi.common.annotation.Excel;
import com.ruoyi.hospital.entity.ComboPackageReturnHospital;
import com.ruoyi.service.domain.ServicePackages;

import java.util.ArrayList;
import java.util.List;

/**
 * 服务套餐耗材包关系体
 *
 * @author ZDL
 */
@lombok.Data
public class CheckPackageRsp {

    /** 服务套餐ID */
    private Long comboId;

    /** 服务套餐名称 */
    @Excel(name = "服务套餐名称")
    private String comboName;

    //耗材包
    private List<CheckPackageItem> packages;


    public void init(ComboPackageReturnHospital newNode) {
        this.comboId = newNode.getComboId();
        this.comboName = newNode.getComboName();
        if (this.getPackages() == null){
            this.setPackages(new ArrayList<CheckPackageItem>());
        }
        if (newNode.getPackages() != null){
            for (ServicePackages packages : newNode.getPackages()) {
                if (packages.getPackagesId() != 0){
                    CheckPackageItem item = new CheckPackageItem();
                    item.init(packages);
                    this.getPackages().add(item);
                }
            }
        }
    }
}
